/// [Lattice paths](https://projecteuler.net/problem=15)
fn main() {
    for length in &[2, 20] {
        println!("{}:{}", length, lattice_paths(*length));
    }
}
fn lattice_paths(n: u64) -> u64 {
    let mut mul = 1;
    let mut y = 2;
    for x in (n + 1)..=(n * 2) {
        if y <= n && mul % y == 0 {
            mul /= y;
            y += 1;
        }
        mul *= x;
    }
    while y <= n {
        mul /= y;
        y += 1;
    }
    mul
}
